{{define "Title"}}Set Item{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/splitPage.js"></script>
<script type=text/javascript src="/js/enterKey.js"></script>
<script type=text/javascript src="/js/setitem.js"></script>
<script type=text/javascript src="/js/addoption.js"></script>
<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/setitem" method="POST">
  <fieldset>
    <legend><b>Set Item</b></legend>
    {{if .error}}<div class="alert alert-error"><b>Error: </b>{{.error | html}}</div>
    {{else }}
      {{if .flash}}<div class="alert alert-success"><b>Infomation: </b>{{.flash | html}}</div>{{end}}
    {{end}}
    <div class="control-group">
      <label class="control-label">Item&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="item" name="item" style="background-color: #FFFFD0;" onkeydown="clicka();" onblur="addnew('itemnumber', 'factory', value);" maxlength="30"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Product Code&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="prodcode" name="prodcode" onkeydown="clicka();" maxlength="10">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Factory Code&nbsp;</label>
      <div class="control">
      {{if eq .ProductionLine "SFPRD06"}}
        <select id="factory" name="factory" onkeydown="clicka();" onmousewheel="return false">
      {{else}}
        <select id="factory" name="factory" style="background-color:#FFFFD0" onkeydown="clicka();" onmousewheel="return false">
      {{end}}        
          <option value="">
          {{range .facs}}
            <option value="{{.Code | html}}">{{.Code | html}}
          {{end}}
        </select> {{if ne .ProductionLine "SFPRD06"}}<b style="color: red">*</b>{{end}}
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Description&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="descrip" name="descrip" onkeydown="clicka();" maxlength="50">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Routing&nbsp;</label>
      <div class="control">
        <select name="rout" onkeydown="clicka();" onmousewheel="return false">
          <option value="">
          {{range .routings}}
            <option value="{{.Name | html}}">{{.Name | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Pack Qty&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="packqty" name="packqty" onkeydown="clicka();" value="1">
      </div>
    </div>
    {{range .band}}
    <div>
      <label class="control-label"></label>
      <div class="control">
        <input type="checkbox" id="{{.Data | html}}" name="{{.Data | html}}" value ="1" >{{.Data | html}}&nbsp;MHz 
      </div>
    </div>
    {{end}}
    <div class="control-group">
    <label class="control-label">Limit&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="limit" name="limit" onkeydown="clicka();" maxlength="100"> {{if ne .ProductionLine "SFPRD06"}}dBm{{end}}
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">Set Item</button>
    </div>
  </fieldset>
</form>
</div>

{{if .items}}
<div class="content-box">
  <div class="content-box-header">
    <p style="font-size: 16px;">&nbsp;&nbsp;<b>Item Detail</b></p>
  </div>
  <div class="content-box-content">
    <span id=obj1 style="color: black">
    <table id="tbl_ls" border="1" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>Index</th>
          <th>Item</th>
          <th>Description</th>
          <th>Band</th>
          <th>Limit</th>
          <th>Routing</th>
          <th>Type</th>
          <th>Code</th>
          <th>FacCode</th>
          <th>PackQty</th>
          <th>Lock</th>
        </tr>
      </thead>
      <tbody id="group_one">
      {{range .items}}
      {{$curls := .}}
      <tr>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.Index | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Item | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Desc | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Band | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Limit | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/routing?q={{.Route | html}}">{{.Route | html}}</a></td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.PrdType | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.PrdCode | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.FacCode | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.PackQty | html}}</td>
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.Locked | html}}</td>
      </tr>
      {{end}}
    </tbody>
    </table>
  </span>
  </div>
  </div>
<span id="spanFirst"><img id='first' src="/images/FirstPageImageUrl.gif" onclick="onFirstClick();"/></span> <span id="spanPre"><img id='prev' src="/images/PreviousPageImageUrl.gif" onclick="onPrevClick();"/></span> <span id="spanNext"><img id='next' src="/images/NextPageImageUrl.gif" onclick="onNextClick();"/></span> <span id="spanLast"><img id='last' src="/images/LastPageImageUrl.gif" onclick="onLastClick();"/></span> Page: <span id="spanPageNum">{{.curr_page}}</span> / Total: <span id="spanTotalPage">{{.total_page}}</span> <span><input id="specialnum" style="width: 60px; color: blue; font-size: 14px; font-weight: bold;" type="text" onkeydown="onSpecialKeydown();"></span><span id="GotoSpecial" style="font-size: 14px; font-weight: bold; cursor:hand; text-decoration:underline; color: #57a000;" onclick="onSpecialClick();">Goto!</span>
<input type=button id="itemssnquery" value="ff" style="display:none">
<label id="itemnumber" name="itemnumber" type=hidden />

{{end}}
{{end}}